// @ts-ignore
import type {UpdateRequest, UserLoginRequest, UserVo} from "./typing";
import myAxios from "../request";
import type {UserPageQueryRequest} from "./typing";

export const userLoginRequestByPost = (userLoginRequest: UserLoginRequest) => {
    return myAxios.request<UserVo>({
        method: "POST",
        url: "/auth/login",
        data: userLoginRequest
    })
}


export const getUserInfoRequestByGet = () => {
    return myAxios.request<UserVo>({
        method: "GET",
        url: "/auth/info"
    })
}


export const logoutUserRequestByPost = () => {
    return myAxios.request({
        method: "POST",
        url: "/auth/logout"
    })
}

export const pageQueryUserListByGet = (userPageQueryRequest: UserPageQueryRequest) => {
    return myAxios.request({
        method: "get",
        url: "/user/page",
        params: userPageQueryRequest
    })
}

export const banUserRequestByPost = (updateRequest: UpdateRequest) => {
    return myAxios.request({
        method: "POST",
        url: "/user/ban",
        data: updateRequest
    })
}

export const unbanUserRequestByPost = (updateRequest: UpdateRequest) => {
    return myAxios.request({
        method: "POST",
        url: "/user/unban",
        data: updateRequest
    })
}